<?php
/*
 * This file is part of the Dektrium project.
 *
 * (c) Dektrium project <http://github.com/dektrium>
 *
 * For the full copyright and license information, please view the LICENSE.md
 * file that was distributed with this source code.
 */

use dektrium\user\widgets\Connect;
use yii\helpers\Html;
use yii\widgets\ActiveForm;

/**
 * @var yii\web\View                   $this
 * @var dektrium\user\models\LoginForm $model
 * @var dektrium\user\Module           $module
 */

$this->title                   = Yii::t('user', 'Sign in');
$this->params['breadcrumbs'][] = $this->title;
?>



<div class="login-box">
    <!-- /.login-logo -->
    <div class="login-box-body card" style="width:35%;margin:20px auto;">
        <div class="card-header">用户登录</div>
        <div class="card-block" style="padding:20px;">
            <p class="login-box-msg"><?= $this->render('/_alert', ['module' => Yii::$app->getModule('user')]) ?></p>

            <?php
            $form                          = ActiveForm::begin([
                        'id'                     => 'login-form',
                        'enableAjaxValidation'   => true,
                        'enableClientValidation' => false,
                        'validateOnBlur'         => false,
                        'validateOnType'         => false,
                        'validateOnChange'       => false,
                    ])
            ?>

            <?= $form->field($model, 'login', ['inputOptions' => ['autofocus' => 'autofocus', 'class' => 'form-control', 'tabindex' => '1']]) ?>

            <?= $form->field($model, 'password', ['inputOptions' => ['class' => 'form-control', 'tabindex' => '2']])->passwordInput()->label(Yii::t('user', 'Password') . ($module->enablePasswordRecovery ? ' (' . Html::a(Yii::t('user', 'Forgot password?'), ['/user/recovery/request'], ['tabindex' => '5']) . ')' : '')) ?>
            <div>
                <div class="col-xs-8">
                    <div class="checkbox icheck">
                        <?= $form->field($model, 'rememberMe')->checkbox(['tabindex' => '4']) ?>
                    </div>
                </div>
                <!-- /.col -->
                <div class="col-xs-4">
                    <?= Html::submitButton(Yii::t('user', 'Sign in'), ['class' => 'btn btn-primary btn-block btn-flat', 'tabindex' => '3']) ?>
                </div>
                <!-- /.col -->
            </div>
            <?php $form->end(); ?>
            <div class="social-auth-links text-center">
                <p>- OR -</p>

                <?=
                Connect::widget([
                    'baseAuthUrl' => ['/user/security/auth'],
                ])
                ?>
            </div>
        </div>
        <!-- /.social-auth-links -->
    </div>
    <!-- /.login-box-body -->
</div>
